﻿using IPC.ListConnect.Connect;
using IPC.LogCommon.log4net;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IPC.WinForm.Controller
{
    [ApiController]
    [Route("[controller]")]
    public class ReadValuesController : ControllerBase
    {
        /// <summary>
        /// 按组读
        /// </summary>
        /// <param name="connectName">通道名</param>
        /// <param name="equipName">设备名</param>
        /// <param name="groupName">组名（可以不传）</param>
        /// <returns></returns>
        [HttpGet(Name = "Read")]
        public async Task<string> Get(string connectName, string equipName, string groupName = "")
        {
            LogClass.Instance.Info($"ReadValuesController:connectName{connectName},equipName{equipName},groupName{groupName}");
            string json = ConnectList.Instance.ReadJson(connectName, equipName, groupName);
            return await Task.FromResult(json);
        }
        
    }
}
